--- <movevent event="AddItem" tileitem="1" itemid="7426" script="RPG/stick.lua"/>

local transform_table = { --- [moveitem.itemid] = {moveitemCount (nil = 1), newId, newCount (nil = 1), effect (nil = standard), groundId (nil = dont seerch tile item)}
	[2120] = {newId = 2580, effect = CONST_ME_BLOCKHIT} --- fishing rod
}

function onAddItem(moveitem, tileitem, position)
--[[
	local STICK = nil
	STICK = transform_table[moveitem.itemid]
	
	if STICK == nil then
		return false
	end
	
	STICK.moveitemCount = (STICK.moveitemCount == nil) and 0 or STICK.moveitemCount
	
	if STICK.moveitemCount ~= moveitem.type or (STICK.groundId ~= nil and getThingFromPos({x = position.x, y = position.y, z = position.z, stackpos = STACKPOS_GROUND}).itemid ~= STICK.groundId)  then
		return false
	end
	STICK.newCount = (STICK.newCount == nil) and 1 or STICK.newCount
	STICK.effect = (STICK.effect == nil) and CONST_ME_BLOCKHIT or STICK.effect
	
	doRemoveItem(moveitem.uid)
	doRemoveItem(tileitem.uid)
	doSendMagicEffect(position, STICK.effect)
	
	if STICK.newId ~= nil and STICK.newId ~= 0 then
		doCreateItem(STICK.newId, STICK.newCount, position)
	end
	]]
	if craftingMovements(moveitem, tileitem, position, transform_table[moveitem.itemid]) then
		doRemoveItem(tileitem.uid)
	end
	
	return true
end